import request from '@/utils/request'

// 查询钥匙列表
export function getKeyList(query) {
  return request({
    url: '/lock/key/list',
    method: 'get',
    params: query
  })
}

// 查询钥匙详细
export function getKey(id) {
  return request({
    url: '/lock/key/' + id,
    method: 'get'
  })
}

// 新增钥匙
export function addKey(data) {
  return request({
    url: '/lock/key',
    method: 'post',
    data: data
  })
}

// 创建临时钥匙
export function createTempKey(data) {
  return request({
    url: '/lock/key/temp',
    method: 'post',
    data: data
  })
}

// 修改钥匙
export function updateKey(data) {
  return request({
    url: '/lock/key',
    method: 'put',
    data: data
  })
}

// 删除钥匙
export function delKey(id) {
  return request({
    url: '/lock/key/' + id,
    method: 'delete'
  })
}

// 启用钥匙
export function enableKey(id) {
  return request({
    url: '/lock/key/enable/' + id,
    method: 'put'
  })
}

// 禁用钥匙
export function disableKey(id) {
  return request({
    url: '/lock/key/disable/' + id,
    method: 'put'
  })
} 